<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "project_categories".
 *
 * @property int $id
 * @property string $title 类别名
 * @property int $pid 父类别
 * @property int $order 顺序
 * @property string $created_at
 */
class ProjectCategoriesDjr extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'project_categories';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('forge');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'order'], 'required'],
            [['pid', 'order'], 'integer'],
            [['created_at'], 'safe'],
            [['title'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '类别名',
            'pid' => '父类别',
            'order' => '顺序',
            'created_at' => 'Created At',
        ];
    }

    /**
     * @inheritdoc
     * @return ProjectCategoriesDjrQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new ProjectCategoriesDjrQuery(get_called_class());
    }
}
